import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote'

// 查询人口伤亡评估列表
export function listPopulation(id) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/getAll',
    method: 'get',
    params: {
      status: 0,
      id: id,
    }
  })
}

// 查询人口伤亡评估列表
export function listPopulations(id) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/getAll',
    method: 'get',
    params: {
      status: 1,
      id: id,
    }
  })
}

// 查询人口伤亡评估详细
export function getPopulation(data) {
  return request({
    url: '/fxfzaqbz/data//casAndUrgen/getById',
    method: 'get',
    params: data
  })
}

// 上传人口伤亡评估
export function uploadPopulation(data) {
  return request({
    url: '/fxfzaqbz/data/saveCasualties',
    method: 'post',
    data: data
  })
}

// 修改人口伤亡评估
export function updatePopulation(data) {
  return request({
    url: '/fxfzaqbz/data/updateCasualties',
    method: 'post',
    data: data
  })
}

// 删除人口伤亡评估
export function delPopulation(data) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/delete',
    method: 'post',
    data: data
  })
}

// 提交是否需要覆盖
export function isCoverData(iaId) {
  return request({
    url:  `/fxfzaqbz/data/getNum/${iaId}`,
    method: 'get',
  })
}

export function coverData(data) {
  return request({
    url: '/fxfzaqbz/data/cover',
    method: 'get',
    params: data
  })
}

// 提交最终成果
export function firstSubmitCasualties(data) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/submit',
    method: 'post',
    data: data
  })
}

// 标题是否重复
export function titleCheck(data) {
  return remoteRequest('titleCheck', data, () => {
    return request({
      url: '/fxfzaqbz/data/casualtiesIfRepetition',
      method: 'post',
      data: data
    })
  })
}

// 编辑描述
export function updataDescribe(data) {
  return request({
    url: '/fxfzaqbz/data/addCasualtiesDisaster',
    method: 'post',
    data: data
  })
}

// 移除数据
export function removeDisasterAss(data) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/remove',
    method: 'post',
    data: data
  })
}

// 提交
export function secondSubmitDisasterAss(ids) {
  return request({
    url: '/fxfzaqbz/data/secondSubmitCasualties/' + ids,
    method: 'post',
  })
}

// 下载
export function getPath(data) {
  return request({
    url: '/fxfzaqbz/data/casAndUrgen/getPath',
    method: 'get',
    params: data
  })
}